
Ext.namespace('business.equipment');

	// 主页面
	business.equipment.MailViewer = Ext.extend(Ext.Panel, {
		
		/**
		 * 左侧变电站树
		 */ 
		bdztree  : null,
		
		/**
		 * 右侧设备列表
		 */ 
		sb       : null,
		
		border   : false,

		/**
		 * 变电站ID
		 */ 
		bdzid    : '0',
		bdzname  : '',

		/**
		 * 间隔或屏柜ID
		 */ 
		typeid   : '0',
		typename : '',

		/**
		 * 间隔或屏柜状态
		 */ 
		state    : '0',
		
		/**
		 * 间隔电压
		 * @type 
		 */
		jgdy : '',
		equipArray : null,
		
		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			this.addListener('render', function() {
				obj.startViewer.defer(1, obj);
			});

			this.layout	= 'fit';
			
			business.equipment.MailViewer.superclass.initComponent.call(this);
		},
		
		/**
		 * 初始化顺序处理
		 */
		startViewer : function() {
			
			// 初始化页面
			this.renderViewer();


		},
		
		/**
		 * 加载控件
		 */
		renderViewer : function() {

			var obj = this;

			//----------------------------------------------------------------------
			//	变电站树生成
			//----------------------------------------------------------------------
			this.bdztree = new business.equipment.BdzTree({
				region				: 'west',
				layout              : 'fit',
				border              : false,
				split				: true,
				collapsible			: true,
				animCollapse		: false,
				width				: 200,    
                minSize				: 175,   
                maxSize				: 250,
                title               : '变电站列表'
               
			});
			
			//----------------------------------------------------------------------
			//	变电站树事件 
			//----------------------------------------------------------------------
			this.bdztree.on({
				
				// 单击时
				'loadGrid' : function (node) {

					// 变电站
					 if (node.attributes.qtip == 'bdz') {
						
						obj.bdzid = node.id.toString().replace('bdz','');
						obj.bdzname = node.text;
						obj.typeid = '0';
						obj.typename = '';
						obj.state = '0';
						obj.jgdy = '';
						///obj.fireEvent('loadGrid');
						
					 // 隔断电压
					} else if (node.attributes.qtip == 'jgdy') {
						
						obj.bdzid = node.parentNode.id.toString().replace('bdz','');
						//obj.bdzid = node.id.toString().replace('jgdy','').split('@')[0];						
						obj.bdzname = node.parentNode.text;
						obj.typeid = '0';
						obj.typename = '';
						obj.state = '0';
						
						// 间隔电压
						obj.jgdy = node.id.replace('jgdy','').split('@')[1];
						///obj.fireEvent('loadGrid');						
						
						// 间隔
					} else if (node.attributes.qtip == 'jg') {
						obj.bdzid = node.parentNode.parentNode.id.toString().replace('bdz','');
						obj.bdzname = node.parentNode.parentNode.text;
						obj.typeid = node.id;
						obj.typename = node.text;
						obj.state = node.attributes.state;
						
						// 间隔电压
						obj.jgdy = node.parentNode.id.replace('jgdy','').split('@')[1];
						///obj.fireEvent('loadGrid');
						
						// 屏柜
					} else if (node.attributes.qtip == 'pg') {
						obj.bdzid = node.parentNode.parentNode.parentNode.id.toString().replace('bdz','');
						obj.bdzname = node.parentNode.parentNode.parentNode.text;
						obj.typeid = node.id;
						obj.typename = node.text;
						obj.state = node.attributes.state;
						
						// 间隔电压
						obj.jgdy = node.parentNode.parentNode.id.replace('jgdy','').split('@')[1];

					} else {
						obj.bdzid = '0';
						obj.bdzname = '';
						obj.typeid = '0';
						obj.typename = '';
						obj.state = '';
						obj.jgdy = '';
					}					
					
					obj.sb.gridstore.baseParams['searchBean.con2'] = obj.bdzid;
					obj.sb.gridstore.baseParams['searchBean.con3'] = obj.typeid;
					obj.sb.gridstore.baseParams['searchBean.con4'] = '';
					obj.sb.gridstore.baseParams['searchBean.con5'] = '';
					obj.sb.gridstore.baseParams['searchBean.con7'] = obj.jgdy;
					obj.sb.gridstore.reload({params:{start:0}});
				},
				
				'resetGrid' : function (node) {
					obj.bdzid = '0';
					obj.bdzname = '';
					obj.typeid = '0';
					obj.typename = '';
					obj.state = '';
					obj.jgdy = '';
					obj.sb.gridstore.removeAll();
					obj.sb.items.each(function (item) {
						if (item.closable) {
							obj.sb.remove(item);
						}
					});
				}
				
			})

			//----------------------------------------------------------------------
			//	设备列表生成
			//----------------------------------------------------------------------
			this.sb = new business.equipment.BdzSb({
				region				: 'center',
				//layout              : 'fit',
              	activeTab           : 0
			});
			
			//----------------------------------------------------------------------
			//	设备事件 
			//----------------------------------------------------------------------
			this.sb.on({

				// 一次设备新建、修改
				'addTab' : function (ids, sblx, sblxname, jsp, bdzname, typename, modelid) {
					
					var tabid = '';
					
					// 新建
					if (ids == '0') {
			
						if (obj.state != '1') {
							Ext.MessageBox.alert('提示', '新建一次设备时请先选择隔断');
							return;
						}
						
						tabid = sblx + '_0';
						
						if (obj.sb.getItem(tabid) != null && obj.sb.getItem(tabid) != undefined) {
							obj.sb.setActiveTab(obj.sb.getItem(tabid));
							return;
						}

						var url = contextpath + '/jsp/business/equipment/' + jsp + '?id=0&sblx='+ sblx + '&sblxname=' + encodeURI(sblxname);
	
						// 修改
					} else {
						
						if (obj.sb.getItem(ids) != null && obj.sb.getItem(ids) != undefined) {
							obj.sb.setActiveTab(obj.sb.getItem(ids));
							return;
							
						} else {
//alert(ids);
							tabid = ids;

							// 二次设备
							var url = contextpath + '/jsp/business/equipment/ecsb.jsp?id=' + tabid + '&modelid=' + modelid + '&sblxname=' + encodeURI(sblxname) + '&bdzname=' + encodeURI(bdzname) + '&typename=' + encodeURI(typename);
							//alert("1"+sblx);
							// 一次设备
							if (sblx != undefined) {

								// 获得JSP
			    				obj.equipArray.each(function(item) {
									if (sblxname == item.get('itemName')) {//window.alert(sblxname);window.alert(bdzname);
										jsp = item.get('remark');//alert(jsp);
										url = contextpath + '/jsp/business/equipment/' + jsp + '?id=' + ids + '&modelid=' + modelid +  '&sblxname=' + encodeURI(sblxname) + '&bdzname=' + encodeURI(bdzname) + '&typename=' + encodeURI(typename);
									}
			    				})
							}
						}
					}
					
					// 打开详细页面TAB
					obj.sb.add({
						id       : tabid,
						closable : true,
						html     : "<div scrolling='no' style= 'overflow:hidden'><iframe id='" + tabid + "' src= '" + url + "' width='100%' height='100%' frameborder='0' scrolling='no'></iframe></div>",
						layout   : 'fit',
						title    : sblxname
					})
					
					obj.sb.setActiveTab(obj.sb.getItem(tabid));

				},
				
				// 二次设备新建、修改
				'addSecondEquip' : function (ids) {
					
					var tabid = 'essb_0';

					// 新建
					//if (obj.state != '2') {
					//	Ext.MessageBox.alert('提示', '新建二次设备时请先选择屏柜');
					//	return;
					//}
					
					var url = contextpath + '/jsp/business/equipment/ecsb.jsp?id=' + ids + '&bdzname=' + obj.bdzname + '&typename=' + obj.typename;

					// 打开详细页面TAB
					obj.sb.add({
						id       : tabid,
						closable : true,
						html     : "<div scrolling='no' style= 'overflow:hidden'><iframe id='" + tabid + "' src= '" + url + "' width='100%' height='100%' frameborder='0' scrolling='no'></iframe></div>",
						layout   : 'fit',
						title    : '二次设备'
					})
					
					obj.sb.setActiveTab(obj.sb.getItem(tabid));

				},
				
				// 将设备类型设置为全局变量
				'setEquip' : function (arrs) {
					obj.equipArray = arrs;
				},
				
				// 点击查询按钮时
				'loadGrid' : function (arrs) {
					
					if (obj.bdzid == '0') {
						Ext.MessageBox.alert('提示', '请先选择变电站');
						return;
					}
					obj.sb.gridstore.reload({params:{start:0}});
				}

			})

			var viewer = ({
				layout          : 'border',
				border			: false,
				items           : [obj.bdztree, obj.sb]
			})
			
			this.add(viewer);

			if ((typeof this.layout) == "object") this.doLayout();

		}

		
	});

	/**
	 * 左侧变电站树
	 */
	business.equipment.BdzTree = Ext.extend(Ext.Panel, {
	
		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			this.tree = new Ext.tree.TreePanel({
				
	            id:"bdz_tree",   
	            root : new Ext.tree.AsyncTreeNode({   
	        		id : "0", 
	        		draggable:false, 
	        		singleClickExpand:true, 
	        		text : treetitle,
	        		qtip : ''
				}),   
				loader:new Ext.tree.TreeLoader({
	        		url : 'equip!getBdzTree.do?parentid=',
	        		listeners:{"beforeload":function(loader, node){ 
	        			var qtip = node.attributes.qtip;						
	        			var temp = ''
	        			if (qtip == 'jgdy'){
	        				temp = '&bdzid=' + node.parentNode.id;
	        			}
						loader.url ='equip!getBdzTree.do?parentid=' + node.id + temp;
							
	        		}}
	   		 	}),
		        useArrows:true,
		        autoScroll:true,
		        animate:true

			});
			
			this.tree.on({
	
				'click' : function(node){
					
					// 变电站电压或者根节点
					if (node.attributes.qtip == 'jydj' || node.attributes.qtip == '') {
						obj.fireEvent('resetGrid');
					} else {
						obj.fireEvent('loadGrid', node);
					}
				}
				
			});
			
			var fromNode;
			var fromType="";
			/* Tree绑定菜单 */
			this.tree.on("contextmenu",function (node,e) {
				myNode = node
				e.preventDefault();   
				memu.showAt(e.getXY()); 				
			});
			
			/* 右键事件 */
			var memu = new Ext.menu.Menu({   
				allowOtherMenus:true,   
				items:[{   
					text:'复制',
					hidden:btn_copy, 
					handler:copyMenu
				},{   
					text:'粘贴',
					hidden:btn_paste,
					disabled:true,
					handler:pasteMenu
				}]   
			}); 
			/**
			 * 复制
			 */
			function copyMenu(){
			var qtip=myNode.attributes.qtip;			
			if(qtip=="jg"){
			fromType="jg";	
			fromNode=myNode;				
			btn_paste=false;								
			this.parentMenu.items.items[1].disabled=false;
			}else if(qtip=="pg"){
			fromType="pg";	
			fromNode=myNode;				
			btn_paste=false;								
			this.parentMenu.items.items[1].disabled=false;
			}else{
			Ext.MessageBox.alert('提示', '只能复制间隔或屏柜！');
			return;
			}						
			};
			/**
			 * 粘贴
			 */
			function pasteMenu(){		
			this.parentMenu.items.items[1].disabled=true;
			btn_paste=true;
			var qtip=myNode.attributes.qtip;
			if(qtip=="jg"&&fromType=="jg"){			//从间隔到间隔
			fromType="";	
			Ext.MessageBox.confirm('提示', '确定要将【' + fromNode.text + '】信息复制到【'+myNode.text+'】吗？', function (btn) {				
				if (btn == 'yes') {
					Ext.Ajax.request({
						method :'POST',
						url :'equip!copyJgToJg.do',
						params : {
							fromId :fromNode.id,
							targetId:myNode.id
						},
						success : function(response) {
							Ext.MessageBox.alert('提示', response.responseText);
							//obj.grid.store.reload();
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '复制失败！');
						}
					});
				}

			});	
			}else if(qtip=="pg"&&fromType=="jg"){		//从间隔复制到屏柜	
			fromType="";	
			Ext.MessageBox.confirm('提示', '确定要将【' + fromNode.text + '】信息复制到【'+myNode.text+'】吗？', function (btn) {				
				if (btn == 'yes') {
					Ext.Ajax.request({
						method :'POST',
						url :'equip!copyJgToPg.do',
						params : {
							fromId :fromNode.id,
							targetId:myNode.id
						},
						success : function(response) {
							Ext.MessageBox.alert('提示', response.responseText);
							//obj.grid.store.reload();
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '复制失败！');
						}
					});
				}

			});	
			}else if(qtip=="pg"&&fromType=="pg"){		//从屏柜复制到屏柜	
			fromType="";	
			Ext.MessageBox.confirm('提示', '确定要将【' + fromNode.text + '】信息复制到【'+myNode.text+'】吗？', function (btn) {				
				if (btn == 'yes') {
					Ext.Ajax.request({
						method :'POST',
						url :'equip!copyPgToPg.do',
						params : {
							fromId :fromNode.id,
							targetId:myNode.id
						},
						success : function(response) {
							Ext.MessageBox.alert('提示', response.responseText);
							//obj.grid.store.reload();
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '复制失败！');
						}
					});
				}

			});	
			}else if(qtip=="jg"&&fromType=="pg"){		//从屏柜复制到间隔	
			fromType="";	
			Ext.MessageBox.confirm('提示', '确定要将【' + fromNode.text + '】信息复制到【'+myNode.text+'】吗？', function (btn) {				
				if (btn == 'yes') {
					Ext.Ajax.request({
						method :'POST',
						url :'equip!copyPgToJg.do',
						params : {
							fromId :fromNode.id,
							targetId:myNode.id
						},
						success : function(response) {
							Ext.MessageBox.alert('提示', response.responseText);
							//obj.grid.store.reload();
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '复制失败！');
						}
					});
				}

			});	
			}		
			};	
			// 注册事件
			this.addEvents(
				'loadGrid',
				'resetGrid'
			);

			this.items = [this.tree];
			
			business.equipment.BdzTree.superclass.initComponent.call(this);
			
		}

	});
	
	/**
	 * 右侧变电站设备
	 */
	business.equipment.BdzSb = Ext.extend(Ext.TabPanel, {
		
		/**
		 * 设备列表
		 */
		grid : null,
		
		/**
		 * 间隔列表数据源
		 */
		gridstore : null,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;

			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getEquipList.do'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzname', 'bdzid', 'typename', 'dydjname', 'sblxname', 'tyrq', 'state','yxbh','sbname','modelid']
				}),
				baseParams:{
					limit:20
				},
				autoLoad:false,
				remoteSort :false
			});

			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "sb_grid",
				store 				: obj.gridstore,
				region 				: 'west',
				enableDragDrop		: false,
				stripeRows			: true,
				title               : '设备信息列表',
				//split				: true,
				//collapsible			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
			           new Ext.grid.RowNumberer({
			                header:'No.',
			                width:40,
			                renderer:function(value,metadata,record,rowIndex){
		                        if (record.store.lastOptions.params != undefined) {
		                       	 	var start = record.store.lastOptions.params.start;
		                       	 	return start + rowIndex+1;
		                		} else {
		                			return rowIndex+1;
		                		}
			                }
			            }),
	            		//sm,
						{	id:'id',
							header :"序号",
							//width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"变电站",
							//width :70,
							dataIndex :'bdzname',
							sortable :true,
							align:'center'
						}, {
						header :"设备名称",
							//width :200,
							dataIndex :'sbname',
							sortable :true,
							align:'center'
						}, {
							header :"设备位置（所属隔断、屏柜）",
							//width :200,
							dataIndex :'typename',
							sortable :true,
							align:'center'
						},{
							header :"设备类型（装置类型）",
							//width :200,
							dataIndex :'sblxname',
							sortable :true,
							align:'center'
						},{
							header :"电压等级",
							dataIndex :'dydjname',
							sortable :true,
							align:'center'
						},{
							header :"运行编号",
							dataIndex :'yxbh',
							sortable :true,
							align:'center'
						},{
							header :"投运日期",
							//width :120,
							dataIndex :'tyrq',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
		    			text : '设备电压等级：'
		    		} , {
                		xtype : 'combo',
                		width:70,
						name : 'con4',
						id:'con4',
						hiddenName : 'searchBean.con4',
						store : new Ext.data.Store({
							proxy : new Ext.data.HttpProxy({
								url : 'dic!getDicJson.do?dic.itemType=DYDJ&emptyFlag=1'
							}),
							reader : new Ext.data.JsonReader({}, ['itemId', 'itemName']),
							autoLoad : true
						}),
						displayField : 'itemName',
						valueField : 'itemId',
						forceSelection : true,
						selectOnFocus : true,
						editable : false,
						triggerAction : 'all',
						mode : 'local',
						emptyText:'请选择'
					}, '-', {
		    			text : '一次设备类型：'
		    		} , {
                		xtype : 'combo',
                		width:90,
						name : 'con5',
						id:'con5',
						hiddenName : 'searchBean.con5',
						store : new Ext.data.Store({
							proxy : new Ext.data.HttpProxy({
								url : 'dic!getEquipDicJson.do?dic.itemType=SBLX1&emptyFlag=1'
							}),
							reader : new Ext.data.JsonReader({}, ['itemId', 'itemName']),
							autoLoad : true
						}),
						displayField : 'itemName',
						valueField : 'itemId',
						forceSelection : true,
						selectOnFocus : true,
						editable : false,
						triggerAction : 'all',
						mode : 'local',
						emptyText:'请选择'
					}, '-', {
		    			text : '二次设备装置类型：'
		    		} , {
                		xtype : 'combo',
                		width:90,
						name : 'con6',
						id:'con6',
						hiddenName : 'searchBean.con6',
						store : new Ext.data.Store({
							proxy : new Ext.data.HttpProxy({
								url : 'dic!getEquipDicJson.do?dic.itemType=SBLX2&emptyFlag=1'
							}),
							reader : new Ext.data.JsonReader({}, ['itemId', 'itemName']),
							autoLoad : true
						}),
						displayField : 'itemName',
						valueField : 'itemId',
						forceSelection : true,
						selectOnFocus : true,
						editable : false,
						triggerAction : 'all',
						mode : 'local',
						emptyText:'请选择'
					}, '-', {
						id :'noteList_query',
						text :'查询',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.searchSb();
        				}
					}, btn_insert ? '' : '-',{
						id :'btn_insert',
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
        				hidden:btn_insert
					}, btn_insert ? '' : '-',{
						id :'btn_copy_insert',
						text :'复制新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/new-save.gif',
        				hidden:btn_insert,
        				handler:function() {
							if (obj.grid.getSelectionModel().getSelected() == null) {
								Ext.MessageBox.alert("提示","请先选择要复制的记录");
								return;
							}
							var record = obj.grid.getSelectionModel().getSelected()['data'];
							obj.insertSb(record['id'], '' , record['sblxname'],'', record['bdzname'],record['typename'], record['id']);
        				}
					}, btn_delete ? '' : '-',{
						id :'bdz_delete',
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteSb();
        				}
					}, btn_delete ? '' : '-',{
						id :'bdz_edit',
						text :'编辑',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/edit.gif',
        				hidden:btn_insert,
        				handler:function() {
        					obj.editSb();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:20,
					displayInfo :true,
					displayMsg :'显示 {0} - {1} 共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
								
					var record = obj.grid.getSelectionModel().getSelected()['data'];
					obj.insertSb(record['id'], '' , record['sblxname'],'', record['bdzname'],record['typename'],record['modelid']);
				}}
			});

			//----------------------------------------------------------------------
			//	列表事件
			//----------------------------------------------------------------------
			this.addEvents(
				'addTab',
				'setEquip',
				'loadGrid',
				'addSecondEquip'
			);
			
			//----------------------------------------------------------------------
			//	加载新建设备类型菜单
			//----------------------------------------------------------------------
			var menudata = new Ext.data.Store({
								proxy : new Ext.data.HttpProxy({
								url : 'dic!getEquipDicJson.do?dic.itemType=SBLX1'
							}),
							reader : new Ext.data.JsonReader({}, ['itemId', 'itemName', 'remark']),
							autoLoad : false
						});
						
			menudata.load({
    			callback: function(records, options, success){
    				
    				var arr = new Array();
    				
    				obj.fireEvent('setEquip', menudata);

    				menudata.each(function(item) {

    					//alert(menudata.getAt(0).get('itemName'));
    					
						var temp = new Ext.Action({
							id			: item.get('itemId'),
							text		: item.get('itemName'),
							//tooltip		: '修改当前间隔',
							//iconCls		: 'icon_edit',
							handler		: function() { obj.insertSb('0', item.get('itemId'),item.get('itemName'),item.get('remark'))}
						});

						arr.push(temp);
					});
					
					var menuFirst = new Ext.menu.Menu({ items : arr});
					
					Ext.getCmp('btn_insert').menu = new Ext.menu.Menu({
						items  : [{
							text : '一次设备',
							menu : menuFirst
						}, {
							text : '二次设备',
							handler : function () {
								obj.fireEvent('addSecondEquip','0');
							}
						}]
					})
        		}
 
			});

			this.items = [
				this.grid
			]
			
			business.equipment.BdzSb.superclass.initComponent.call(this);
			
		},
	
		/**
		 * 删除
		 */
		deleteSb: function() {
			
			var obj = this;
			
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要删除的记录");
				return;
			}
			
			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
			
			Ext.MessageBox.confirm('提示', '确定要删除选中的记录吗？', function (btn) {
				
				if (btn == 'yes') {

					Ext.Ajax.request({
						method :'POST',
						url :'equip!delete.do',
						params : {
							id :ids
						},
						success : function(response) {
							
							Ext.MessageBox.alert('提示', response.responseText, function () {
								obj.grid.store.reload();
							});
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '删除失败！');
						}
					});
				}

			});
			
		},
		editSb: function(){
			var obj = this;
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要编辑的记录");
				return;
			}
			var record = obj.grid.getSelectionModel().getSelected()['data'];
			obj.insertSb(record['id'], '' , record['sblxname'],'', record['bdzname'],record['typename'],record['modelid']);
		},
		/**
		 * 新建时
		 */
		insertSb: function(ids, sblx, sblxname, jsp, bdzname, typename, modelid) {
			this.fireEvent('addTab', ids, sblx, sblxname, jsp, bdzname, typename,modelid);
		},
		
		/**
		 * 查询
		 */
		searchSb: function() {
			this.gridstore.baseParams['searchBean.con4'] = Ext.getCmp('con4').getValue();
			this.gridstore.baseParams['searchBean.con5'] = Ext.getCmp('con5').getValue();
			this.fireEvent('loadGrid');
		}	
	});